const puppeteer = require('puppeteer-extra');
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
puppeteer.use(StealthPlugin())

let instance = null
module.exports.getBrowserInstance = async function() {
  if (!instance) {
    instance = await puppeteer.launch({
        headless: true,
        executablePath: `/usr/bin/google-chrome`,
        args: [
            '--no-sandbox',
            '--disable-setuid-sandbox'
        ]
    })
  }
  return instance
}